package com.xinqi.modules.databank.v2.manager.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.databank.dto.req.CourseResourceQuestionQueryDTO;
import com.xinqi.modules.databank.dto.rsp.QuizResultDTO;
import com.xinqi.modules.databank.v2.domain.CourseResourceQuestionEntity;
import com.xinqi.modules.databank.v2.manager.ResourceQuestionManager;
import com.xinqi.modules.databank.v2.mapper.CourseResourceQuestionMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 资料库提问-Manager层
 * @author dzy
 */
@Service
@RequiredArgsConstructor
public class ResourceQuestionManagerImpl extends BaseServiceImpl<CourseResourceQuestionMapper, CourseResourceQuestionEntity> implements ResourceQuestionManager {

    private final CourseResourceQuestionMapper resourceQuestionMapper;

    /**
     * 获取提问列表
     * @author dzy
     */
    @Override
    public IPage<QuizResultDTO> selectQuiz(IPage<QuizResultDTO> page, CourseResourceQuestionQueryDTO queryDTO) {
        return resourceQuestionMapper.selectQuiz(page, queryDTO);
    }

    /**
     * 更具PID获取提问列表
     * @author dzy
     */
    @Override
    public IPage<QuizResultDTO> selectQuizByPid(IPage<QuizResultDTO> page, CourseResourceQuestionQueryDTO queryDTO) {
        return resourceQuestionMapper.selectQuizByPid(page, queryDTO);
    }


    /**
     * 添加提问
     * @author dzy
     */
    @Override
    public QuizResultDTO selectQuizById(Long id, Long classId, Long userId) {
        return resourceQuestionMapper.selectQuizById(id, classId, userId);
    }

}
